<template>
  <div class="box">
      <h3>v-model</h3>
      <el-input v-model="value" placeholder="请输入关键词" />
      <h4>父组件传递过来的数据：{{title}}</h4>
  </div>
</template>

<script>
export default {
  name: 'Child',
  props: {
    title: {
      type: String,
      default: ''
    }
  },
  computed: {
    value: {
      get () {
        return this.title
      },
      set (val) {
        const temp = val
        this.$emit('update:title', temp)
        return temp
      }

    }
  },
  data () {
    return {
    //   value: ''
    }
  }
}
</script>

<style lang="less" scoped>
.box{
    width: 50%;
    margin: 10px auto;
}
</style>
